package com.example.yichuangyun.mvvm.ui.fragment.view;

import androidx.lifecycle.MutableLiveData;

import com.example.yichuangyun.config.Constant;
import com.example.yichuangyun.model.contacts.ContactsBusinessDataModel;
import com.example.yichuangyun.mvvm.base.BaseViewModel;
import com.example.yichuangyun.mvvm.di.retrofit.BaseModel;
import com.example.yichuangyun.mvvm.di.retrofit.BaseNetCallback;

public class BusinessRecordViewModel extends BaseViewModel {

    public MutableLiveData<ContactsBusinessDataModel> contactsBusinessData = new MutableLiveData<>();

    public void getBusinessRecordList(String contactId, int examine) {
        addSubscribe(mRetrofitHelper.getContactsBusinessList(contactId, examine).subscribeWith(new BaseNetCallback<ContactsBusinessDataModel>() {
            @Override
            public void onSuccess(BaseModel<ContactsBusinessDataModel> baseModel) {
                if (Constant.SUCCESS == baseModel.getCode()) {
                    contactsBusinessData.setValue(baseModel.getData());
                }
            }
        }));
    }
}
